package com.woniu.common.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;


@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResponseResult<T> {
    private int code;
    private String msg;
    private T data;

    //将访问结果定义为常量
    public static final ResponseResult<Void> SUCCESS=new ResponseResult<>(200,"success",null);
    public static final ResponseResult<Void> FAIL=new ResponseResult<>(500,"fail",null);

    public static ResponseResult<Void> ok(){
        return new ResponseResult<>(200,"success",null);
    }
    public static <T> ResponseResult<T> ok(T data){
        return  new ResponseResult<>(200,"success",data);
    }


}
